﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Sub.aspx.cs" Inherits="XHCTMS.VIEW.Sub" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link rel="shortcut icon" href="/favicon.ico">
	<link rel="apple-touch-icon" href="/apple-touch-icon.png">
	<link rel="stylesheet" href="css/style.css?v=2">
	
	<!-- fluid 960 -->
	<link rel="stylesheet" type="text/css" href="css/text.css" media="screen" />
	<link rel="stylesheet" type="text/css" href="css/layout.css" media="screen" />
	<link rel="stylesheet" type="text/css" href="css/grid.css" media="screen" />
	<!-- superfish menu -->
	<link rel="stylesheet" type="text/css" href="css/superfish.css" media="screen" />
	<!-- tags css -->
	<link rel="stylesheet" href="css/jquery.tagsinput.css">
	<!-- treeview css -->
	<link rel="stylesheet" href="css/jquery.treeview.css">
	<!-- dataTable css -->
	<link rel="stylesheet" href="css/demo_table_jui.css">


	<!-- fluid GS -->
	<link rel="stylesheet" type="text/css" href="css/fluid.gs.css" media="screen" />
	<!--[if lt IE 8 ]>
	<link rel="stylesheet" type="text/css" href="css/fluid.gs.lt_ie8.css" media="screen" />
	<![endif]-->

	<!-- //jqueryUI css -->
	<link type="text/css" href="css/custom-theme/jquery-ui-1.8.13.custom.css" rel="stylesheet" />
	
	<!-- //jquery -->
	<!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> -->
	<script src="js/libs/jquery-1.5.1.min.js"></script>
	<script>	    !window.jQuery && document.write(unescape('%3Cscript src="js/libs/jquery-1.5.1.min.js"%3E%3C/script%3E'))</script>
	<!-- //jqueryUI -->
	<script type="text/javascript" src="js/jquery-ui-1.8.13.custom.min.js"></script>
	<script type="text/javascript" src="js/jquery-fluid16.js"></script>
	<script src="js/plugins.js"></script>
	<script src="js/script.js"></script>
	
	<!-- //xoxco tags plugin https://github.com/xoxco/jQuery-Tags-Input -->
	<script src="js/jquery.tagsinput.min.js"></script>
	<link rel="stylesheet" href="css/jquery.tagsinput.css">
	
	<!--[if lt IE 7 ]>
	<script src="js/libs/dd_belatedpng.js"></script>
	<script> DD_belatedPNG.fix('img, .png_bg');</script>
	<![endif]-->
	<!-- modernizr -->
	<script src="js/libs/modernizr-1.7.min.js"></script>
	
	<!-- superfish menu and needed js for menu -->
	<script src="js/superfish.js"></script>
	<script src="js/supersubs.js"></script>
	<script src="js/hoverIntent.js"></script>

	<!-- treeview -->
	<script src="js/jquery.treeview.js"></script>
    <link href="css/ACE.css" rel="stylesheet" type="text/css" />
	<!-- dataTable -->
	<script src="js/jquery.dataTables.min.js"></script>
   
    <style type="text/css">

    </style>
	    <script type="text/javascript">
	        $(function () {

	            $("#dialogAdd").dialog({ autoOpen: false, width: 530, modal: true,
	                buttons: {
	                    "确定": function () {
	                        if ($("#lblAddPrompt").html().length <= 0) {
	                            $("#txtAddSubName").trigger("onblur");

	                        }
	                        if ($("#lblAddPrompt").html().length <= 0) {
	                            $("#txtAddSubYears").trigger("onblur");

	                        }

	                        if ($("#lblAddPrompt").html().length <= 0) {
	                            $("#btnAdd").trigger("click");
	                        }
	                    },
	                    "取消": function () {
	                        $(this).dialog("close");
	                    }
	                }

	            })


	            $("#dialogAlter").dialog({ autoOpen: false, width: 530, modal: true,
	                buttons: {
	                    "确定": function () {
	                        if ($("#lblAlterPrompt").html().length <= 0) {
	                            $("#txtAlterSubName").trigger("onblur");

	                        }
	                        if ($("#lblAlterPrompt").html().length <= 0) {
	                            $("#txtAlterSubYears").trigger("onblur");

	                        }

	                        if ($("#lblAlterPrompt").html().length <= 0) {
	                            $("#btnAlter").trigger("click");
	                        }
	                    },
	                    "取消": function () {
	                        $(this).dialog("close");
	                    }
	                }

	            })
	            $("#dialogPrompt").dialog({ autoOpen: false, widht: 530, modal: true,
	                buttons: {
	                    "确定": function () {
	                        $(this).dialog("close");
	                    } 
	                }
	            })


	            $("#aFirst").click(function () {
	                var page = '<%=Session["page"]%>';
	                if (page <= 1) {
	                    return false;
	                }
	                $("#btnAFirst").trigger("click");
	            })
	            $("#aPrevious").click(function () {
	                var page = $("#ddlPage option:selected").text().split("/")[0];
	                var maxPage = $("#ddlPage option:selected").text().split("/")[1];
	                if (page <= 1) {
	                    return false;
	                }
	                if (page > maxPage) {
	                    page = maxPage;
	                }
	                $("#btnAPrevious").trigger("click");
	            })
	            $("#aNext").click(function () {
	                var page = $("#ddlPage option:selected").text().split("/")[0];
	                var maxPage = $("#ddlPage option:selected").text().split("/")[1];
	                if (page >= maxPage) {
	                    return false;
	                }
	                if (page < 1) {
	                    page = 1;
	                }
	                $("#btnANext").trigger("click");
	            })
	            $("#aLast").click(function () {
	                var page = $("#ddlPage option:selected").text().split("/")[0];
	                var maxPage = $("#ddlPage option:selected").text().split("/")[1];
	                if (page >= maxPage) {
	                    return false;
	                }
	                $("#btnALast").trigger("click");
	            })




	            $("#divAdd").click(function () {
	                $("#dialogAdd").dialog("open");
	                //   $("#btnAdd").trigger("click");
	            });
	            $("#divSearch").click(function () {
	                $("#btnSearch").trigger("click");
	            });
	            //	            $("#divAlter").click(function () {
	            //	                $("#btnAlter").trigger("click");
	            //	            });
	            //	            $("#divUpdate").click(function () {
	            //	                $("#btnUpdate").trigger("click");
	            //	            });
	            //	            $("#divDelete").click(function () {
	            //	                $("#btnDelete").trigger("click");
	            //	            });
	        });
	        function toTemp(txtName, tempName) {
	            document.getElementById(tempName).value = document.getElementById(txtName).value;
	        }
	        function NullPrompt(txtName, proName, message) {
	            if ($("#" + txtName).val().length <= 0) {
	                $("#" + proName).html(message);
	                return false;
	            }
	            else {
	                $("#" + proName).html("");
	                return true;
	            }
	        }

	        function YearNaN(txtYear, proName, message) {
	            var reg = /(^[1-5]$)/;
            var year = $("#" + txtYear).val().trim();
	            if (!reg.test(year)) {
	                $("#" + proName).html(message);
	                return false;
	            }
	            else {

	                    $("#" + proName).html("");
	                    return true;
	            }
	            }

	            function selecttr(t) {
	                $("#txtTempSubID").val($(t).parent().parent().find("td :eq(0)").html());
	                $("#txtTempSubName").val($(t).parent().parent().find("td :eq(1)").html());
	                $("#txtAlterSubName").val($(t).parent().parent().find("td :eq(1)").html());
	                $("#txtTempSubYears").val($(t).parent().parent().find("td :eq(2)").html());
	                $("#txtAlterSubYears").val($(t).parent().parent().find("td :eq(2)").html());
	                $("#txtTempSubDesc").val($(t).parent().parent().find("td :eq(3)").html());
	                $("#tAreaAlterSubDesc").val($(t).parent().parent().find("td :eq(3)").html());
	                $("#dialogAlter").dialog("open");
	            }

	            function setFlag(t) {
	                if (confirm("是否停用 " + $(t).parent().parent().find("td :eq(1)").html() + $(t).parent().parent().find("td :eq(2)").html() + "年制 的专业" +
                "\n停用后将不能被恢复")) {
	                    $("#txtTempSubID").val($(t).parent().parent().find("td :eq(0)").html());
	                    $("#btnDelete").trigger("click");
	                }
	            }

	            function Prompt() {
                $('#pPrompt').html('你好');$('#dialogPrompt').dialog('open');
	            }
	        
    </script>
  
</head>
<body id="Body1" runat="server">
  <form id="form1" runat="server">
    <div class="box">
						<h2>
							<a href="#" id="toggle-forms">专业信息</a>
						</h2> 
						<div class="block" id="forms">
							
								<fieldset>
									<legend>操作区</legend>
              
                    
                       <div style="width:700px">
                          <label>  专业名称:
                            </label>
                                                   
                     <asp:DropDownList ID="ddlSubName" runat="server" class=" dropdownlist">  
                                    </asp:DropDownList>
                    
                    
                   
                       
                           <label> 专业学制:
                            </label>
                           <%-- <select id="ddlSubYear" runat="server" class="dropdownlist"  ></select>--%>
                                    <asp:DropDownList ID="ddlSubYear" runat="server" class=" dropdownlist">  
                                    </asp:DropDownList>
                    
               
                 
                       <%--  <label>   专业介绍:
                            </label>
                            <asp:TextBox ID="txtSubDesc" runat="server" ></asp:TextBox>--%>
                   
                       <br />
                

                          <label>  专业状态:
                            </label>
                          <input id="rbtnUse" type="radio" runat="server" name="State"  class="radio" checked="true" /> <span>在用</span>
                        <input id="rbtnUnUse" type="radio" runat="server" name="State" class="radio" /> <span>过期</span>
                       
                 <br />
                   <br />
              
                                     	    
             
                    <div id="divAdd" class="six column">
                        <a href="javascript:void(0)" id="A7" class=" dialog_link ui-state-default ui-corner-some floatRight">
                            <span class=" span-ui-icon ui-icon ui-icon-circle-plus "></span>增加</a>
                    </div>
                    <div id="divSearch" class="six column">
                        <a href="javascript:void(0)" id="A8" class=" dialog_link ui-state-default ui-corner-some floatRight">
                            <span class=" span-ui-icon ui-icon ui-icon-search "></span>查询</a>
                    </div>
                        </div>                              
									</fieldset>
							
						</div>
					</div>
       <asp:Button ID="btnAdd" runat="server"  UseSubmitBehavior="false"   style=" display:none"  Text="Button" onclick="btnAdd_Click" />
       <asp:Button ID="btnSearch" runat="server"  style=" display:none" Text="Button" onclick="btnSearch_Click" />
       <asp:Button ID="btnAlter" runat="server"  UseSubmitBehavior ="false"  style=" display:none" Text="Button" onclick="btnAlter_Click" />
       
       <asp:Button ID="btnDelete" runat="server"  style=" display:none" Text="Button" onclick="btnDelete_Click" />

    <div class="box">
						 <h2>
            <a href="#" id="toggle-list">信息列表</a>
        </h2>
        <div class="block" id="list">
            <asp:Repeater ID="infolist" runat="server">
                <HeaderTemplate>
                    <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
                        <thead>
                            <tr>
                                <th>
                                    名称
                                </th>
                                <th>
                                    学制
                                </th>
                                <th>
                                    介绍
                                </th>
                                <th style=" text-align:center">
                                    状态
                                </th>
                            </tr>
                        </thead>
                </HeaderTemplate>
                <ItemTemplate>
                    <tbody>
                        <tr class="odd gradeA">
                        <td style="display:none"><label><%#Eval("sub_id")%></label></td>
                            <td>
                                <label> <%#Eval("sub_name")%></label>
                            </td>
                            <td>
                               <label> <%#Eval("sub_years")%></label>
                            </td>
                            <td>
                                <label><%#Eval("sub_desc")%></label>
                            </td>
                            <td style="text-align:center">
                              <a href="javascript:void(0)" onclick="selecttr(this)">修改</a>&nbsp;&nbsp;&nbsp;
                              <a href="javascript:void(0)" onclick="setFlag(this)">停用</a>
                            </td>
                        </tr>
                    </tbody>
                </ItemTemplate>
                <FooterTemplate>
                    <tfoot>
                        <tr>
                            <th>
                                名称
                            </th>
                            <th>
                                学制
                            </th>
                            <th>
                                介绍
                            </th>
                            <th style="text-align:center">
                                状态
                            </th>                      
                        </tr>
                    </tfoot>
                  
                </FooterTemplate>
            </asp:Repeater>

              </table>
                        	   <a id="aLast" href="#" class=" dialog_link ui-state-default ui-corner-some floatRight " >尾页</a>
                                                         
			    <a id="aNext" href="#" class=" dialog_link ui-state-default ui-corner-some floatRight" >下一页</a>
									                                        
                            <asp:DropDownList ID="ddlPage"  
                                
                class="dialog_link ui-state-default ui-corner-some floatRight" Width="85px"  AutoPostBack="true"
                                runat="server" 
                onselectedindexchanged="ddlPage_SelectedIndexChanged" >
                            </asp:DropDownList> 
                           
				<a id="aPrevious"  href="#" class=" dialog_link ui-state-default ui-corner-some floatRight ">上一页</a>
                                          
                                         
				<a id="aFirst" href="#" class=" dialog_link ui-state-default ui-corner-some floatRight">首页</a>
        </div> 
       </div>
       
       
       <div id="dialogAdd" title="新增专业" style=" display:none">
       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名称 
           <asp:TextBox ID="txtAddSubName" runat="server" onblur="NullPrompt('txtAddSubName','lblAddPrompt','请填写专业名');toTemp('txtAddSubName','txtTempSubName')" class="txt"></asp:TextBox>
             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;学制
           <asp:TextBox ID="txtAddSubYears" runat="server" onblur="if(NullPrompt('txtAddSubYears','lblAddPrompt','请填写专业学制')){YearNaN('txtAddSubYears','lblAddPrompt','学制请填写1-5年数');};toTemp('txtAddSubYears','txtTempSubYears')" class="txt"></asp:TextBox>     
           <div style="width:40px; position: relative; top: 6px; left: 25px;">描述</div>
               <textarea rows="6"  runat="server" style="width:388px; position: relative; top: -6px; left: 62px; "  
               id="tAreaAddSubDesc" onblur="toTemp('tAreaAddSubDesc','txtTempSubDesc')"></textarea>
               <br />
             &nbsp;&nbsp;&nbsp;
               <label id="lblAddPrompt" style="color:Red"></label>
       </div>


            
       <div id="dialogAlter" title="新增专业" style=" display:none">
       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名称 
           <asp:TextBox ID="txtAlterSubName" runat="server" onblur="NullPrompt('txtAlterSubName','lblAlterPrompt','请填写专业名');toTemp('txtAlterSubName','txtTempSubName')" class="txt"></asp:TextBox>
             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;学制
           <asp:TextBox ID="txtAlterSubYears" runat="server" onblur="if(NullPrompt('txtAlterSubYears','lblAlterPrompt','请填写专业学制')){YearNaN('txtAlterSubYears','lblAlterPrompt','学制请填写1-5年数');};toTemp('txtAddSubYears','txtTempSubYears')" class="txt"></asp:TextBox>     
           <div style="width:40px; position: relative; top: 6px; left: 25px;">描述</div>
               <textarea rows="6"  runat="server" style="width:388px; position: relative; top: -6px; left: 62px; "  
               id="tAreaAlterSubDesc" onblur="toTemp('tAreaAddSubDesc','txtTempSubDesc')"></textarea>
               <br />
             &nbsp;&nbsp;&nbsp;
               <label id="lblAlterPrompt" style="color:Red"></label>
       </div>
       <div id="dialogPrompt" title="系统提示"> 
       
       <p id="pPrompt"></p>
       
       </div>




  <asp:Button ID="btnAFirst" runat="server" Text="Button" style="display:none"
        onclick="btnAFirst_Click" />
  <asp:Button ID="btnAPrevious" runat="server" Text="Button"  style="display:none"
        onclick="btnAPrevious_Click"/>
  <asp:Button ID="btnANext" runat="server" Text="Button" onclick="btnANext_Click" style="display:none" />
  <asp:Button ID="btnALast" runat="server" Text="Button" onclick="btnALast_Click"  style="display:none"/>
  <asp:TextBox ID="txtTempSubID" runat="server" style="display:none" ></asp:TextBox>
  <asp:TextBox ID="txtTempSubName" runat="server" style="display:none" ></asp:TextBox>
  <asp:TextBox ID="txtTempSubYears" runat="server" style="display:none"></asp:TextBox>
  <asp:TextBox ID="txtTempSubDesc" runat="server" style="display:none"></asp:TextBox>
  
  
       
      
     </form>
       
</body>
</html>
